﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ditua.aspx.cs" Inherits="weba.ditua" %>

<%@ Register assembly="C1.Web.Wijmo.Controls.4, Version=4.0.20133.145, Culture=neutral, PublicKeyToken=9b75583953471eea" namespace="C1.Web.Wijmo.Controls.C1Accordion" tagprefix="wijmo" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
   <style type="text/css">
	html { height:100% }
	body { height:100%; margin:0px; padding:0px }
	   #container {
           height: 450px;
           width: 800px;
           float: left;
       }
       #form1 {
           width: 800px;
           height: 300px;
           float: left;
       }
       #ztd {
           height: auto;
           width: 150px;
           float: left;
       }
   </style>
    <script type="text/javascript"
	src="http://webapi.amap.com/maps?v=1.2&key=ab5ae8097e26040fa604012b73e78f03">
</script>   
<script type="text/javascript">
    var ln;
    var point
    function raa()
    {
        
    // x=   WebService.HelloWorld();
     //  alert("adda");
     //  x = ln.getLng();
      //  var y = ln.getlnt();
        alert(x);
       
    }
    function a() {
        //  weba.wajax.HelloWorld(onresult);
        x = ln.getLng();
        y = ln.getLat();
      weba.wajax.xiougai(x,y,'<%= Request.QueryString["id"] %>', onresult)

    }
    function onresult(result) {
        alert(result);
    }
    function initialize()
    {
        jd = '<%= Request.QueryString["jd"] %>'
        wd = '<%= Request.QueryString["wd"] %>'
        var mapObj = new AMap.Map("container"); // 创建地图实例
        if (jd == "") {
            point = new AMap.LngLat(121.550331, 29.868038); // 创建点坐标
        }
        else
        {
            point = new AMap.LngLat(jd, wd);
            var markera = new AMap.Marker({
                id: "m122",
                position: new AMap.LngLat(jd, wd),
                icon: "http://webapi.amap.com/static/images/marker_sprite.png",
                offset: { x: -8, y: -34 }
            });// 创建点坐标
            mapObj.addOverlays(markera);
        }
       
        //  alert(ln.getLng());
      
       // var point = new AMap.LngLat(116.404, 39.915); // 创建点坐标
        mapObj.setCenter(point); // 设置地图中心点坐标
       
        mapObj.bind(mapObj, "click", function (e) {
            ln = e.lnglat;
            var marker = new AMap.Marker({
                id: "m123",
                position: e.lnglat,
                icon: "http://webapi.amap.com/static/images/marker_sprite.png",
                offset: { x: -8, y: -34 }
            });
          //  alert(ln.getLng());
            mapObj.addOverlays(marker);
            mapObj.setCenter(ln);
            
        });
    }
    
</script>
   
     

</head>
<body  onLoad="initialize()">
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="LinqDataSource1">
            <Columns>
                <asp:BoundField DataField="id" HeaderText="id" ReadOnly="True" SortExpression="id" />
                <asp:BoundField DataField="firstName" HeaderText="firstName" ReadOnly="True" SortExpression="firstName" />
                <asp:BoundField DataField="lastName" HeaderText="lastName" ReadOnly="True" SortExpression="lastName" />
                <asp:BoundField DataField="lx" HeaderText="lx" ReadOnly="True" SortExpression="lx" />
                <asp:BoundField DataField="ly" HeaderText="ly" ReadOnly="True" SortExpression="ly" />
            </Columns>
        </asp:GridView>
      
        <input id="Button1" type="button" value="改为此位置" onClick="a()" /><asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="刷新页面" />
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="weba.sjklqDataContext" EntityTypeName="" Select="new (id, firstName, lastName, lx, ly)" TableName="People" Where="id == @id">
            <WhereParameters>
                <asp:QueryStringParameter Name="id" QueryStringField="id" Type="String" />
            </WhereParameters>
        </asp:LinqDataSource>
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True">
            <Services>
                <asp:ServiceReference Path="wajax.asmx"  />
            </Services>
        </asp:ScriptManager>
        </div>
         
   <div id="container"></div> 
    
       
        
    </form>
        
   </body>
</html>
